<?php
/**
 * 示例控制器
 * 工作台控制器
 * @author IIIThSoul
 *
 */
namespace Manage\Controller;

class IndexController extends ManageController
{
    public function Index()
    {
        $this->display();
    }
    
    /**
     * 工作台
     */
    public function Workbench()
    {
        $this->display();
    }
    
    /**
     * 数据列表，常规表格
     */
    public function Datalist()
    {
        $this->display();
    }
    
    /**
     * 图片列表
     */
    public function Imglist()
    {
        $this->display();
    }
    
    /**
     * 表单
     */
    public function Form()
    {
        $this->display();
    }
    
    /**
     * RSA实示例
     */
    public function Rsa()
    {
        
        $data = 'Hello World';
        $key  = '123';
        $public_key = <<<EOT
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8d2THCQpX9B4LajSurqek+PgB
qV8oLzYil8qotJzl25knSKUATwczyi81WUhiEVdsL4i2aSTXI6bJza9Zi1APi1r/
Ggv9suCkKdjiwStNHELE6h/m+fNaOAslyI2foTWPRv4fBzXqyFHU/1kOfGbT1Zd5
oZjG2ePM7+zSRnFZWwIDAQAB
-----END PUBLIC KEY-----
EOT;
        $private_key = <<<EOT
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC8d2THCQpX9B4LajSurqek+PgBqV8oLzYil8qotJzl25knSKUA
Twczyi81WUhiEVdsL4i2aSTXI6bJza9Zi1APi1r/Ggv9suCkKdjiwStNHELE6h/m
+fNaOAslyI2foTWPRv4fBzXqyFHU/1kOfGbT1Zd5oZjG2ePM7+zSRnFZWwIDAQAB
AoGAM3SRgjn4pfzTeyBbE9pBkSwcYi/A+DKzoAw7W4Y8VBF5ph0SV5w8BirMas9e
kM/VQ4dS1yKr2UU1k2Fh35vGlo/tykoHdV7aghCrKCoSzGyFx7U1kTe8vXyIlNJZ
JZv1Smcf6INN+XuHlxqxADze9hbmc0TZLJ3xUNBxDqbzv5ECQQDeBGOrOTPkZA1g
D1Mb5XpavGj2AzKxeNVMXoqmPxKNK03A6OxsAEeYqaIXs9NhzIUd+UvxwaBEPBwt
fD/DQ7xjAkEA2VBWY3s42uvi7dL984xhLiSJfmb7QdOJLiUVGsDH7C5yvB3uKEIH
1KIUoGweBOGojfnbZsf6dZRAF97LT+jUqQJAO3hrhkr9Vnlih8+zEG7o1nNPnk5+
/sECScGtXBjbDEuEOV9rLQbqJr+Rts2pmrHhGoVTzX9zQbPkTF7S6ag0RwJBAKKl
CCMopGLlTVCmK79Of6VjXyylssOPqQpKYsNFKdxQ3zqARDEJSocQT9PJV6ZbpiWs
rVL9tSyvKlEzRIOoRRECQQCekjhONbAIhP4EmuiavpN/d1Nb5DH6yi2VsrUkP/Bn
Pd1OcLuA3/tzoZqd3Yn7CYOgCu6j64iwqCc8li1LhKNW
-----END RSA PRIVATE KEY-----
EOT;
        $en = rsa_encrypt($data, $key, $public_key);
        var_dump($en);
        
        $de = rsa_decrypt($en, $key, $private_key);
        
        var_dump($de);
        
    }
}